/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nz.co.kevindoran.googlechartsjsf.test;

import javax.faces.bean.ManagedBean;
import nz.co.kevindoran.googlechartsjsf.Column;
import nz.co.kevindoran.googlechartsjsf.DefaultGoogleChartModel;
import nz.co.kevindoran.googlechartsjsf.GoogleChartModel;
import nz.co.kevindoran.googlechartsjsf.Row;
import org.joda.time.DateTime;

/**
 *
 * @author Kevin
 */
@ManagedBean
public class ChartBackBean {
 
private GoogleChartModel chartModel = new DefaultGoogleChartModel("AnnotatedTimeLine");
    public ChartBackBean() {
        chartModel.addColumn(new Column(Column.JavaScriptType.date, "Date"));
        chartModel.addColumn(new Column(Column.JavaScriptType.number, "Price"));
        for(int i=20; i>0; i--) {
        DateTime date = DateTime.now().minusDays(i);
        int price = (int) (Math.random() * 10);
        int noOfRows = 2;
        Row row = new Row(noOfRows);
        row.addEntry(date);
        row.addEntry(String.valueOf(price));
        chartModel.addRow(row);
    }
}
 
    public GoogleChartModel getChartModel() {
        return chartModel;
    }
}